#include <stdio.h>

#define modulus(a,b) a%b;

int main()
{
	int x,y;
	scanf("%d %d",&x,&y);
	int ret=modulus(x,y);
	printf("%d",ret);
	return 0;
}